﻿#ifndef ICDMANAGEMENT_H
#define ICDMANAGEMENT_H

#include <QWidget>
#include <QVector>
#include <QMap>
#include <QTreeWidget>
#include <QMessageBox>
#include "SQLOperation/SQLManagement.h"
#include "AnalysisPlanManagement/AnalysisPlanManagement.h"
#include "ICDManagement/ImportWindow.h"

namespace Ui {
class ICDManagement;
}

class ICDManagement : public QWidget
{
    Q_OBJECT

public:
    explicit ICDManagement(QWidget *parent = nullptr);
    ~ICDManagement();

    void loadData();   //加载数据
    void analogData(); //模拟授权模块数据
    void setPlaneTypeIDNameData();  //设置初始机型ID和名称数据
    void SetIcon();  //设置图标
    void getPlaneTypeID(QString planeTypeID); //获取授权机型id信息

private slots:
    void on_pbDelete_clicked();  //删除icd
    void on_pbExport_clicked(); //导出icd
    void on_pbImport_clicked(); //导入icd
    void onItemButtonClicked(); //处理icdTree的点击事件

signals:
    void openAnalysisPlanMGT(CustomModule openModule, CustomModule closeModule); //打开解析方案管理控件的信号

private:
    Ui::ICDManagement *ui;
    ImportWindow importW;  //导入窗口

    QVector<ICD_INFO> m_ICDInfoVec;  //存放ICD信息
    QVector<int> m_ModuleInfoVec;  //模拟的授权模块信息
    QMap<int,QString> m_BuildNodeMap;  //建立了节点的机型信息
    QMap<int,QString> m_PlaneTypeIDNameMap;  //机型ID和名称信息
    QMap<int,QTreeWidgetItem*> m_PlaneTypeItemMap;  //机型ID和名称信息
    QMap<QTreeWidgetItem*,int> m_ICDidItemMap; //icd_id和该item信息
    QMap<QPushButton*,int> m_ICDidButtonMap; //icd_id和该Button信息

    QIcon m_planeIcon;  //机型图标
    QIcon m_fileIcon; //文件图标
    QIcon m_infoIcon; //信号图标
    QIcon m_folderIcon; //文件夹图标

    QString m_PlaneTypeIDStr; //授权机型id
};

#endif // ICDMANAGEMENT_H
